package com.example.helloworld.controller;
import com.example.helloworld.entity.User;
import org.springframework.web.bind.annotation.*;

@RestController
public class UserController {
    @GetMapping("/user/{id}")
    public String getUserById(@PathVariable int id){
        System.out.println(id);
        return "根据id搜索用户";
    }

    @PostMapping("/user")
    public String save(User user){
        System.out.println(user);
        return "保存用户";
    }

    @PutMapping("/user")
    public String update(User user){
        System.out.println(user);
        return "更新用户";
    }

    @DeleteMapping("/user/{id}")
    public String deleteById(@PathVariable int id){
        System.out.println(id);
        return "根据id删除用户";
    }
}
